/*日期格式化*/
Date.prototype.format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "h+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}
/*今日*/
function getTodayDate(){
    var today = new Date();
    var today = today.format("yyyy-MM-dd");
    return today
}
/*昨日*/
function getYesterdayDate(){
    var today = new Date();
    today.setDate(today.getDate() - 1);
    var yesterday = today.format("yyyy-MM-dd");
    return yesterday;
}
/*本月*/
function getMonthDate(){
    var today = new Date();
    var month = today.format("yyyy-MM");
    return month;
}
/*上月*/
function getLastMonthDate(){
    var date = new Date();
    date.setMonth(date.getMonth()-1)
    var lastMonth = date.format("yyyy-MM");
    return lastMonth;
}
/*近三月*/
function getThreeMonthDate(){
    var date = new Date();
    date.setMonth(date.getMonth() - 2);
    var lastLastMonth = date.format("yyyy-MM");
    var threeMonth = [getMonthDate(),getLastMonthDate(),lastLastMonth];
    return threeMonth;
}
/*今年*/
function getYear(){
    var today = new Date();
    var year = today.format("yyyy");
    return year;
}
/*去年*/
function getLastYear(){
    var date = new Date();
    date.setFullYear(date.getFullYear() - 1);
    var lastYear = date.format("yyyy");
    return lastYear;
}